WSL-Ubuntu on Win10

Windows Subsystem for Linux with OpenCPN 5.0

O5 Linux in Ubuntu 18.04LTS for Windows10

Full credit should be given to TransmitterDan for this configuration and explanation. He wrote:

  1. Running a native Linux version of OpenCPN V5 on native Windows 10 (no virtual machine)
  2. Use the WSL App (Ubuntu for Windows) - previously known as Bash for Windows. Everything needed is available from the regular Windows Store Ubuntu PPA that installs with WSL from the App Store. You don’t need to doctor up the PPA. That will just lead to heartache.
  3. The “trick” is to install a linux desktop manager xfce and an rdp server (remote desktop protocol server) XRDP by Neutrino Labs.
  4. So in this respect it is a lot like a headless mode. In fact, it's exactly like headless mode.
  5. To run OpenCPN you need to install xrdp on the Linux system then connect using the windows Remote Desktop application.
  6. All of the libraries and tools needed to compile and run O can be installed with apt under WSL.
  7. Use git and cmake just like regular Linux (it is real Linux).
  8. Do not use dpkg, tarballs or other packages of unknown provenance.
  9. Use the Linux build instructions from the OpenCPN Developer Manual to download and build the Linux version of OpenCPN.
  10. You can also use RDP from an iPad and interact with O on the iPad. I like RDP better than VNC because it creates a custom screen matching the remote display, and you can’t use VNC with the Windows Linux anyway.

Other Information

The configuration does not use Virtual Box or HyperV, requires a current version a of Windows10 and uses about 2.5gb of hard drive. This system does support graphics applications and OpenGL, because most Linux graphics apps (including OpenCPN) can use X-Windows. All you need is an X server that WSL can talk to. There are multiple solutions available including xrdp, Mobaxterm, etc. I like xrdp the best.

Compiling is pretty fast on my old i7 machine. I can run ‘make -j 12’ and it compiles O in Linux very quickly. Faster than Microsoft Windows compiler even. I have installed ddd for debugging and it works too. So far the overall system seems very stable, responsive and usable. It's a pretty good development platform.

I can compile the latest version of wxWidgets from git and it sort of works. There are a lot of new things in wx that seem at odds with O. The error about can’t seek on files plus lots and lots of gratuitous log file messages coming from wx. The wx team seems to be weeding some of that out.

Installation

A. Change windows settings to enable "Windows System for Linux" (WSL)

B. Install Windows Store App "Ubuntu 18.04LTS"

C. Install Remote Desktop Protocol Server (xRDP) and Linux Desktop Manager (XFCE)

Open the Ubuntu terminal and run:

$ sudo apt install xrdp xfce4 openssh-server
$ sudo service xrdp start
$ sudo service ssh start
   

The apt install will be a long download of about 500mb. You don’t actually need ssh but it can be handy especially if you use WinSCP to access the Linux file system from Windows.

XFCE Linux Desktop provides useful Linux tools such as a File Manager, etc.

The rdp server (remote desktop protocol server) XRDP by Neutrino Labs provides the linux link to the Windows Remote Desktop Client in Windows.

D. Download the required programs needed for OpenCPN

From the OpenCPN Developer Manual:

$ sudo apt-get install build-essential cmake gettext git-core gpsd gpsd-clients libgps-dev wx-common libwxgtk3.0-dev libglu1-mesa-dev libgtk2.0-dev wx3.0-headers libbz2-dev libtinyxml-dev libportaudio2 portaudio19-dev libcurl4-openssl-dev libexpat1-dev libcairo2-dev libarchive-dev liblzma-dev libexif-dev libelf-dev libsqlite3-dev

E. Download Source Code for OpenCPN

From the OpenCPN Developer Manual: Run to get a local copy of the source code:

$ git clone https://github.com/[user]/opencpn.git  (use your github username in place of “user”.)

This will be a long download of about 500mb.

F. Build OpenCPN

From the OpenCPN Developer Manual: Build everything in a subdirectory to keep the codebase clean (easier to catch changes).

$ cd OpenCPN   //# unless already in this directory.//
$ mkdir build
$ cd build
$ cmake ../
$ sudo make install

Once finished, start Remote Desktop Client in Windows Note:Windows 10 Home edition users will need to upgrade to Windows 10 Pro

G. Start Remote Desktop Connection (Client) in Windows

Use the Windows search (bottom left) to find “Remote Desktop Client in Windows App”. Make a Desktop or Start Shortcut. Use Remote Desktop Client to Connect to the Computer .

localhost:3389
Session: xorg
User: same username you used for Ubuntu for Windows.
Password: same password you used for Ubuntu for Windows.
Check to remember username.

Log in to xRDP

H. Remote Desktop Connection (Client) opens the Linux Desktop

This is the xFCE Linux Desktop application

I. Start OpenCPN

From the upper left: Applications > Education (dropdown) > OpenCPN

xFCE Linux Desktop

OpenCPN started.

xFCE Linux Desktop

J. Critical Do Not's

  1. Don’t access the Linux files using Windows Explorer. You can do some harm to the Linux file system by writing a file to those Canonical folders. The names and locations of the Linux files move around.
  2. Use WinSCP to access the Linux file system from Windows. It is sort of like Explorer as it can safely transfer files between Linux and Windows. But Windows Explorer does not fully understand the Linux file system.

Fresh start after computer shutdown

Open Ubuntu terminal

$ sudo service xrdp start
$ sudo service ssh start

From Windows Menus start Remote Desktop Connections (Client) and log in. Opens to the xFCE Linux Desktop From the upper left: Applications > Education (dropdown) > OpenCPN

Helpful Hints

Check where the OpenCPN files are located:

  $ which opencpn
  /usr/bin/opencpn

If the system did not completely install the program so it copies all the style files and so forth to the right places So maybe your install didn't go as planned…. in the build folder type:

 $ sudo make install

Then run OpenCPN from the program start menu on the desktop. Maybe you are starting opencpn from a command line and starting it from the build folder. That won't always work.

Desktop Launcher

Find the Linux Desktop “Launcher” to create an OpenCPN shortcut icon on the desktop.. Use File Manager to find out where opencpn files are stored.

Desktop File Manager

xFCE Linux Desktop File Manager